<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBusinessCartTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('business_cart', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedInteger('num')->comment('商品数量')->default(1);
            $table->unsignedBigInteger('good_id')->comment('商品id号');
            $table->foreign('good_id')->references('id')->on('food');
            $table->unsignedBigInteger('business_id')->comment('购物车商家');
            $table->foreign('business_id')->references('id')->on('business');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('business_cart');
    }
}
